home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / timing.arc / FNCTICKS.DEF next >
Text File  |  1987-10-01  |  966b  |  29 lines

  1. ' def fnCTICKS.def -- returns the number of clock ticks since midnight
  2. '
  3. '       Allows the caller to `mark' the time, with an optional offset
  4. '       ahead in time.  Useful in timing routines
  5. '
  6. ' USAGE:
  7. '       HUN.SCNDS = 100
  8. '       MARK! = FNCTICKS (HUN.SCNDS)  ' # of clock ticks that will
  9. '                    'have occurred since midnite (in 1 sec. from now)
  10. '
  11. 'input: HUN.SCNDS = hundredths of seconds from now
  12. 'output: TIME.MARK! = time marker calculated (clock ticks since midnight)
  13. '
  14.  
  15. def fncticks! (hun.scnds!)
  16.     '$include: 'TICKS.def'
  17.     '$DYNAMIC
  18.     dim registers%(7)
  19.     registers%(0) = 0       'set AH (& AL) to 0 to get clock setting
  20.     call int86 (&h1a,varptr(registers%(0)),varptr(registers%(0)))
  21.     cx!=registers%(2) :dx!=registers%(3)
  22.     cticks! = (cx!*2^16 + dx!) + (hun.scnds!/100*ticks.per.sec!)
  23.     if cticks!>ticks.per.day! then cticks!=cticks!-ticks.per.day!  'passed midnite
  24.     fncticks!=fix(cticks!)
  25.     erase registers%
  26. end def
  27.  
  28.  
  29.